﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NLog;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            // DBLogDeneme();
            DBLogOverWcfService();
        }

        private static void DBLogOverWcfService()
        {
            Console.WriteLine("Service calling...");
            WcfTestService.TestServiceClient proxy = new WcfTestService.TestServiceClient();
            if (!proxy.GetData("deneme"))
                Console.WriteLine("Service returned false");
        }

        private static void DBLogDeneme()
        {
            try
            {
                int count = Convert.ToInt32("test");
            }
            catch (Exception exc)
            {
                Console.WriteLine("Hata Olustu! Loglaniyor...");

                //LogManager.GetCurrentClassLogger().LogException(LogLevel.Error, "Hata Oluştu", exc);

                // Loga custom deger paslamak...
                Logger logger = LogManager.GetCurrentClassLogger();
                LogEventInfo theEvent = new LogEventInfo(LogLevel.Info, "CustomLogger", null, "PleaseLogThis -> Custom değer gonder.", null, exc);
                theEvent.Properties["ID"] = Guid.NewGuid().ToString();
                theEvent.Properties["CustomField"] = "Custom deneme";
                logger.Log(theEvent);

            }
        }
    }
}
